<template>
  <view class="container">
    <view class="list">
      <navigator :url="'/pages/detail/detail?id=' + v._id" class="list-item" v-for="(v, i) in list" :key="i">
        <image :src="v.image" mode=""></image>
        <view class="right">
          <text>{{v.title}}</text>
          <text>{{v.word}}</text>
          <text>{{v.price}}</text>
        </view>

      </navigator>
    </view>
  </view>
</template>

<script>
  export default {
    data() {
      return {
        href: 'https://uniapp.dcloud.io/component/README?id=uniui',
        list: [],
        total: 0,
        pageCode: 1,
        pageSize: 10
      }
    },
    methods: {
      async getData() {
        const resp = await uniCloud.callFunction({
          name: 'getMyList',
          data: {
            pageCode: this.pageCode,
            pageSize: this.pageSize
          }
        })
        this.list = this.list.concat(resp.result.data)
        this.total = resp.result.affectedDocs
      }
    },
    onLoad() {
      this.getData()
    },
    onReachBottom() {
      this.pageCode++;
      this.getData()
    }
  }
</script>

<style>
  .container {
    padding: 20px;
    font-size: 14px;
    line-height: 24px;
  }
</style>
